package cn.e3mall.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.e3mall.common.E3Result;
import cn.e3mall.common.EasyUIDataGridResult;
import cn.e3mall.content.service.ContentService;
import cn.e3mall.pojo.TbContent;

@Controller
@RequestMapping("/content")
public class ContentController {

	@Autowired
	private ContentService contentService;
	
	@RequestMapping("/list")
	@ResponseBody
	public EasyUIDataGridResult getContentList(int page, int rows, Long categoryId) {
		EasyUIDataGridResult resule = contentService.selectContentList(page, rows, categoryId);
		return resule;
	}
	
	@RequestMapping("/add")
	@ResponseBody
	public E3Result addContent(TbContent tbContent) {
		E3Result e3Result = contentService.addEntity(tbContent);
		return e3Result;
	}
	
	@RequestMapping("/delete")
	@ResponseBody
	public E3Result deleteContent(Long[] ids) {
		E3Result result = contentService.deleteByPks(ids);
		return result;
	}
	
	@RequestMapping("/update")
	@ResponseBody
	public E3Result updateContent(TbContent tbContent) {
		E3Result result = contentService.updateContent(tbContent);
		return result;
	}
}
